/**
 * 用于将 url 导入到 body 中
 * @date 2020-08-22
 * @param {String} url js 或 css 的URL
 * @returns {Promise}
 */
function Script(url) {
    return new Promise((res) => {
        let a = {};
        if (/.js$/.test(url)) {
            a = document.createElement("script");
            a.src = url;
        } else if (/.css$/.test(url)) {
            a = document.createElement("link");
            a.href = url;
            a.rel = "stylesheet";
            a.type = "text/css";
        }
        a.onload = () => {
            console.log(url + "载入成功");
            res(true);
        };
        document.body.appendChild(a);
    });
}
